#include "ExchangeHelper.h"
#include "ExchangeReporterTypes.h"
#include "InterOpIO.h"
#include "InterOpProgressTypes.h"

AMCAX_EXCHANGE_NAMESPACE_BEGIN

ExchangeHelper::ExchangeHelper()
{

}

ExchangeHelper &ExchangeHelper::GetInstance() 
{
    static ExchangeHelper instance ;
    return instance ;
}

void ExchangeHelper::SetReporter(ExchangeReporterType reporter)
{
    if (!reporter) {
        return ;
    }
    reporter_ = reporter ;
    
    // AMCAX::Exchange::InterOp::Reporter::LogType log ;
    AMCAX::Exchange::InterOp::IO::GetInstance().SetReporter([this](AMCAX::Exchange::InterOp::Reporter::LogType type,int value){
        OperationType operationType ;
        if (AMCAX::Exchange::InterOp::Reporter::LogType::EXPORT == type) {
            operationType = OperationType::EXPORT ;
        }else if (AMCAX::Exchange::InterOp::Reporter::LogType::IMPORT == type) {
            operationType = OperationType::IMPORT ;
        }
        this->reporter_(operationType, value) ;
    }) ;
}


AMCAX_EXCHANGE_NAMESPACE_END